﻿using System;

public partial class Datesite : System.Web.UI.Page
{
    private DatenightBLL datenightBLL;
    private InterestBLL interestBLL;
    private PersonBLL personBLL;

    protected void Page_Load(object sender, EventArgs e)
    {
        datenightBLL = DatenightBLL.Instance;
        interestBLL = InterestBLL.Instance;
        personBLL = PersonBLL.Instance;
        

        if (Request.QueryString["DatenightId"] != null)
        {
            var Datenight = datenightBLL.findDatenightById(Request.QueryString["DatenightId"]);
            ImgProfilePicture.ImageUrl = personBLL.setProfilePicture(Datenight.Username, Server.MapPath("../images/ProfilePictures/"));
            if (Datenight.aspnet_User.Gender.genderId == 1)
            {
                WriteToBtn.Text = "Skriv til ham";
            }
            else
            {
                WriteToBtn.Text = "Skriv til hende";
            }

            var Interests = interestBLL.findInterestsByUsername(Datenight.Username);

            if (Interests != null)
            {
                InterestsLW.DataSource = Interests;
                InterestsLW.DataBind();
            }
            else
            {
                InterestHead.Visible = false;
            }
            FactsHeader.InnerText = Datenight.aspnet_User.FirstName + Datenight.aspnet_User.LastName;
            DatePlaceTxt.InnerText = Datenight.City.Cityname;
            AgeTxt.InnerText = personBLL.returnAge(Datenight.aspnet_User.Age).ToString();
            GenderTxt.InnerText = Datenight.aspnet_User.Gender.sex;
            WhopaysTxt.InnerText = Datenight.WhoPay;
            DateTimeTxt.InnerText = Datenight.Date.Date.ToString();
            PersonDescriptionTxt.Text = Datenight.aspnet_User.Description;
            DateDescriptionTxt.Text = Datenight.Description;
        }

    }
}